package com.lv.controller;

import com.lv.listener.MyApplicationContextReadyListener;
import com.lv.listener.MyApplicationEnviromentPrepareListener;
import com.lv.listener.MyApplicationStartedEventListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lvjilei on 2018/3/21.
 */
@EnableAutoConfiguration
@RestController
public class SimpleController {


    @ResponseBody
    @RequestMapping("/home")
    public String home(){
        System.out.println("This is aa branch");
        System.out.println("This is stash.");
        return "Hello SimpleContronller!";
    }


    public static void main(String[] args){
        SpringApplication app = new SpringApplication(SimpleController.class);
        app.addListeners(new MyApplicationStartedEventListener());
        app.addListeners(new MyApplicationEnviromentPrepareListener());
        app.addListeners(new MyApplicationContextReadyListener());
        app.run(args);
        //SpringApplication.run(SimpleController.class,args);
    }

}
